#include <bits/stdc++.h>
using namespace std;

// #define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
	{                                         \
		cerr << "\033[32;1m" << #x << " -> "; \
		err(x);                               \
	}
void err()
{
	cerr << "\033[39;0m" << endl;
}
template <typename T, typename... A>
void err(T a, A... x)
{
	cerr << a << ' ';
	err(x...);
}
#else
#define dbg(...)
#endif

typedef long long LL;

const int N = 1e5 + 50;

vector<int> p[26];
int op[26];
char s[N], t[N];

int n, m;

int main(int argc, char const *argv[])
{
	scanf("%s%s", s, t);
	n = strlen(s);
	m = strlen(t);
	if ((n & 1) != (m & 1) || n > m)
	{
		puts("NO");
		return 0;
	}
	int now = 0, p = 0;
	for (int i=0; i<m; ++i)
	{
		if ((i & 1) == p && s[now] == t[i])
		{
			++now;
			if (now == n)
				break;
			p ^= 1;
		}
	}
	if (now == n) puts("YES");
	else puts("NO");
	// dbg(p[0][1]);
	return 0;
}